import request from '@/utils/request'

let preUrl = '/recordApi/records'

export function saveRecord(record, templateId) {
  return request({
    url: preUrl + '/save',
    method: 'put',
    data: {
      record,
      templateId
    }
  })
}

export function getHistoryRecords(patientId) {
  return request({
    url: preUrl + '/history/' + patientId,
    method: 'get'
  })
}

export function getNowRecord(patientId, templateId) {
  return request({
    url: preUrl + '/now/' + patientId + '/' + templateId,
    method: 'get'
  })
}

export function confirmRecord(patientId, recordId) {
  return request({
    url: preUrl + '/confirm/' + patientId + '/' + recordId,
    method: 'patch'
  })
}

export function deleteRecord(patientId, recordId) {
  return request({
    url: preUrl + '/cancel/' + patientId + '/' + recordId,
    method: 'delete'
  })
}

export function getRecordsByIds(recordIds) {
  return request({
    url: preUrl + '/getByIds',
    method: 'post',
    data: recordIds
  })
}